using System;
using System.Xml;

using Google.Apps.Provisioning.Utilities;

namespace Google.Apps.Provisioning.Actions
{
    /// <summary>
    /// Abstract base class definining the contract for a provisioning action.
    /// </summary>
    internal abstract class BaseProvisioningAction
    {
        protected string serviceUrl;
        protected string templatePath;

        protected ProvisioningResponse response;

        public string ServiceUrl
        {
            get { return serviceUrl; }
        }

        public string TemplatePath
        {
            get { return templatePath; }
        }

        public ProvisioningResponse Response
        {
            get { return response; }
            set { response = value; }
        }

        public BaseProvisioningAction( string templatePath, string serviceUrl )
        {
            this.templatePath = templatePath;
            this.serviceUrl = serviceUrl;
        }

        public XmlDocument GetRequestXmlTemplate()
        {
            return EmbeddedResourceUtility.GetXmlDocument( templatePath );
        }

        public abstract void ProcessRequestXml( XmlDocument doc, XmlNamespaceManager ns );
        public virtual void ProcessResponseXml( XmlDocument doc, XmlNamespaceManager ns ) {;}
    }
}
